<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport"
	content="width=device-width,initial-scale=1 user-scalable=0">
<link rel="stylesheet" href="<%=basePath%>assets/css/public.css">
<link rel="stylesheet" href="<%=basePath%>assets/css/page.css">
<title>选择收货地址</title>
<script src="<%=basePath%>assets/js/jquery-1.8.3.min.js"></script>
<script src="<%=basePath%>assets/js/fontSize.js"></script>
<link href="<%=basePath%>/assets/layer/mobile/need/layer.css"
	rel="stylesheet" type="text/css">
<link rel="stylesheet"
	href="<%=basePath%>assets/font-awesome-4.7.0/css/font-awesome.min.css">
<script src="<%=basePath%>/assets/layer/mobile/layer.js"></script>
<link rel="stylesheet" href="<%=basePath%>/assets/imgTools/helmet.css">
<style>
body {
	background: #f1f1f1
}
.header h3 {
	color: #fff;
	font-size: 18px;
}

.content {
	padding-bottom: 0.8rem;
	margin-top: 0.1rem
}

.content ul li {
	border-bottom: 1px solid #ccc;
	background: #fff;
	padding-bottom: 0.2rem
}

.shouhuoxinxi {
	width: 90%;
	float: left
}

.content ul li p {
	font-size: 0.22rem;
	line-height: 0.4rem;
	padding: 0 0.3rem
}

.content ul li p.xingming, .content ul li p.lxdd {
	width: 50%;
	float: left;
	font-size: 0.24rem;
	font-weight: bold;
	line-height: 0.6rem;
	padding: 0;
	text-indent: 0.3rem;
	padding-top: 0.1rem
}

.content ul li p.lxdd {
	text-align: right;
	width: 45%
}

.caozuo {
	width: 10%;
	float: left
}

.caozuo div {
	width: 100%
}

.caozuo div img {
	width: 0.3rem;
	height: 0.3rem;
	margin: 0.55rem auto;
	display: block
}

.xinzengshdz {
	width: 100%;
	position: fixed;
	left: 0;
	bottom: 0
}

.xinzengshdz a {
	width: 100%;
	height: 0.8rem;
	background: #FF3F25;
	color: #fff;
	line-height: 0.8rem;
	font-size: 0.3rem;
	text-align: center;
	display: block
}

.shouhuodizhi {
	width: 100%;
	background: #fff;
	margin-top: 0.8rem;
}

.dwIcon {
	width: 12%;
}

.dwIcon img {
	width: 50%;
	display: block;
	margin: 0.4rem 20%;
}

.shouhuodizhi_xq {
	width: 75%;
	height: 1.2rem;
	line-height: 0.4rem;
}

.shouhuorenxinxi span {
	font-size: 0.28rem;
	height: 0.6rem;
	line-height: 0.6rem;
}

.tiaozhuan {
	width: 13%
}

.tiaozhuan a {
	display: block;
	line-height: 1.2rem;
	font-size: 0.4rem;
	text-align: center
}
</style>
<script>
        $(function () {
            $('.content>ul').find('li').each(function () {

                $(this).find('.shezhimr').click(function () {

                    if($(this).find('img').attr('src') == '<%=basePath%>assets/images/wxz.png'){
                        $(this).find('img').attr('src','<%=basePath%>assets/images/xz.png');
                        $(this).parent().parent().siblings().find('.shezhimr').find('img').attr('src','<%=basePath%>assets/images/wxz.png')
                    }else {
                        $(this).find('img').attr('src','<%=basePath%>assets/images/wxz.png')
                    }

                })
            })
        });
        //选择收货地址
        function DefaultAddress(addressId){
        	var state = '${state}';
        	if(state==1&&state!=null&&state!=''&&typeof(state) != "undefined"){
        		window.location.href="<%=basePath%>app/selectShippingAddress?addressId="+addressId+"&state="+state;
        	}else if(state==2&&state!=null&&state!=''&&typeof(state) != "undefined"){
        		var goodsIdNum = '${goodsIdNum}';
        		var goodsThumsNum = '${goodsThumsNum}';
        		window.location.href="<%=basePath%>app/selectShippingAddress?addressId="+addressId+"&state="+state+"&goodsIdNum="+goodsIdNum+"&goodsThumsNum="+goodsThumsNum;
        	}else{
        		layer.open({
    			    content: '请选择默认地址亲～'
    			    ,skin: 'msg'
    			    ,time: 2 //2秒后自动关闭
    			  });
        	}
        };
    </script>
</head>
<body>
	<div class="header">
		<a class=returnInfo href="#" onclick="window.history.go(-1)"><i class="fa fa-angle-left"></i></a>
		<h3 style="color: black;">选择收货地址</h3>
	</div>
	<!-- 默认地址 -->
	<div class="shouhuodizhi clearFirx"
		onclick="DefaultAddress(${personDefaultAddress.addressId})">
		<div class="dwIcon float_l">
			<img src="<%=basePath%>assets/images/dingwei.png" alt="">
		</div>
		<div class="shouhuodizhi_xq float_l">
			<p class="shouhuorenxinxi clearFirx">
				<span class="shrxingming float_l">${personDefaultAddress.userName}</span><span
					class="shrdianhua float_r">${personDefaultAddress.userPhone}</span>
			</p>
			<p class="xingxidizhi">
				<span style="color: #FF3F25;">[默认地址]</span>${personDefaultAddress.province}${personDefaultAddress.city}${personDefaultAddress.county}${personDefaultAddress.address}</p>
		</div>
	</div>
	<div class="content">
		<ul>
			<c:forEach items="${addressList}" var="addressList">
				<c:if test="${addressList.isDefault eq 0}">
					<li class="clearFirx"
						onclick="DefaultAddress(${addressList.addressId})">
						<div class="shouhuoxinxi">
							<p class="xingming">${addressList.userName}</p>
							<p class="lxdd">${addressList.userPhone}</p>
							<div class="clear"></div>
							<p class="dizhi">${addressList.province},${addressList.city},${addressList.county},${addressList.address}</p>
						</div>
					</li>
				</c:if>
			</c:forEach>
		</ul>
	</div>
	<div class="xinzengshdz">
		<a href="<%=basePath%>jsp/app/addAddress.jsp">新增收货地址</a>
	</div>
</body>
</html>